package leetcode.other;
import java.util.List;
/**
 * @author cyt
 * @create 2020-07-29 9:13
 */
public class T559 {

    public static void  main(String[] args){

    }

    public int maxDepth(Node root) {
        return dfs(root);
    }

    public int dfs(Node root){
        if(root==null){
            return 0;
        }
        int depth =0;
        for (Node child : root.children) {
            depth = Math.max(depth, dfs(child));
        }
        return depth +1;
    }
}
class Node {
    public int val;
    public List<Node> children;

    public Node() {}

    public Node(int _val) {
        val = _val;
    }

    public Node(int _val, List<Node> _children) {
        val = _val;
        children = _children;
    }
};

